gtk4.git
7 years agogl renderer: Fix only_translation check
Timm Bäder [Thu, 29 Nov 2018 14:39:14 +0000 (15:39 +0100)]
gl renderer: Fix only_translation check

7 years agoMerge branch 'force-emoji' into 'master'
Matthias Clasen [Fri, 30 Nov 2018 21:38:02 +0000 (21:38 +0000)]
Merge branch 'force-emoji' into 'master'

Force emoji presentation

See merge request GNOME/gtk!431

7 years agoForce emoji presentation
Matthias Clasen [Tue, 27 Nov 2018 23:16:43 +0000 (18:16 -0500)]
Force emoji presentation

Append a variation selector to the Emoji sequences,
to force Emoji presentation. Without this, some
Emoji come out with text presentation by default.

Closes: Pango #334
7 years agoAdwaita: updated switch control
Jakub Steiner [Fri, 30 Nov 2018 19:53:13 +0000 (20:53 +0100)]
Adwaita: updated switch control

- might be nasty to hide labels with CSS. We can fix properly later.
- the blue border seesm aliased when :checked

7 years agoAdwaita: shade buttons
Jakub Steiner [Thu, 29 Nov 2018 20:54:56 +0000 (21:54 +0100)]
Adwaita: shade buttons

- it was a bit too flat

7 years agoAdwaita: button tweaks
Jakub Steiner [Thu, 29 Nov 2018 19:11:39 +0000 (20:11 +0100)]
Adwaita: button tweaks

- step back on toning down the borders. Flatness !> legibility.
- darker active state for light
- draw gradinets from bottom up, to keep px sized shading regardless
  of button size.

7 years agoAdwaita: headerbar backdrop state
Jakub Steiner [Thu, 29 Nov 2018 13:34:53 +0000 (14:34 +0100)]
Adwaita: headerbar backdrop state

7 years agoAdwaita: sync headerbar styling for devel mode
Jakub Steiner [Thu, 29 Nov 2018 12:12:44 +0000 (13:12 +0100)]
Adwaita: sync headerbar styling for devel mode

7 years agoRemove gtk_widget_intersect
Timm Bäder [Thu, 29 Nov 2018 10:14:26 +0000 (11:14 +0100)]
Remove gtk_widget_intersect

It's been broken for quite a while now and doesn't make sense anymore
these days.

7 years agopopover: Don't recalculate position if unmapped
Timm Bäder [Thu, 29 Nov 2018 07:43:43 +0000 (08:43 +0100)]
popover: Don't recalculate position if unmapped

7 years agogl renderer: Render non-trivial transforms to a texture
Timm Bäder [Thu, 29 Nov 2018 07:09:02 +0000 (08:09 +0100)]
gl renderer: Render non-trivial transforms to a texture

This way we can e.g. render rotated clips, borders, etc.

7 years agoinspect-button: Remove custom pick() implementation
Timm Bäder [Sun, 12 Aug 2018 11:30:15 +0000 (13:30 +0200)]
inspect-button: Remove custom pick() implementation

This was added to work around the fact that pick() does not look at
insensitive widgets at all, but the replacement didn't properly work
either.

7 years agopopover: Get rid of a gtk_widget_get_allocation call
Timm Bäder [Sun, 12 Aug 2018 11:44:35 +0000 (13:44 +0200)]
popover: Get rid of a gtk_widget_get_allocation call

Use _compute_bounds instead.

7 years agogl renderer: Cache offscreen textures per node, not size
Timm Bäder [Wed, 28 Nov 2018 17:40:48 +0000 (18:40 +0100)]
gl renderer: Cache offscreen textures per node, not size

7 years agogl renderer: Expand matrix metadata extraction
Timm Bäder [Wed, 28 Nov 2018 08:30:27 +0000 (09:30 +0100)]
gl renderer: Expand matrix metadata extraction

Instead of getting the translation x/y everytime we use the modelview,
get it once, when extracting the metadata. Do the same with the scale.
And save if the matrix is "simple" at all, i.e. if it only consists of a
translation and/or scale. This will be helpful later when we start
drawing transformed nodes on textures.

7 years agoRevert "gldriver: Don't create surfaces to upload textures"
Timm Bäder [Wed, 28 Nov 2018 16:09:29 +0000 (17:09 +0100)]
Revert "gldriver: Don't create surfaces to upload textures"

This reverts commit 6466e53bfcbbd975a3fd970913844ddb6ccc41d9.

This breaks GtkGLArea.

7 years agowidget: Remove one translate_coordinates copy
Timm Bäder [Tue, 27 Nov 2018 06:12:27 +0000 (07:12 +0100)]
widget: Remove one translate_coordinates copy

Just use the double version in the integer version.

7 years agoAdwaita: flatten the headerbar again
Jakub Steiner [Wed, 28 Nov 2018 19:27:44 +0000 (20:27 +0100)]
Adwaita: flatten the headerbar again

7 years agoAdwaita: tune button & hederbar colors
Jakub Steiner [Wed, 28 Nov 2018 13:17:37 +0000 (14:17 +0100)]
Adwaita: tune button & hederbar colors

7 years agotexttag: Replace gtk3-demo reference with gtk4-demo
Mohammed Sadiq [Wed, 28 Nov 2018 11:21:45 +0000 (16:51 +0530)]
texttag: Replace gtk3-demo reference with gtk4-demo

7 years agoAdwaita: buttons & headerbars
Jakub Steiner [Tue, 27 Nov 2018 23:16:20 +0000 (00:16 +0100)]
Adwaita: buttons & headerbars

- tone down the bottom border contrast (increase bottom lightness,
  decrease overall lightness)
- darken headerbars slightly (might require darkening wm colors when
  dust settles)

7 years agoMerge branch 'master-escape-included-svg' into 'master'
Matthias Clasen [Tue, 27 Nov 2018 20:25:28 +0000 (20:25 +0000)]
Merge branch 'master-escape-included-svg' into 'master'

(#1471): base64-encode included SVGs to avoid mis-escaped characters

Closes #1471

See merge request GNOME/gtk!430

7 years ago(#1471): base64-encode included SVGs to avoid mis-escaped characters
Federico Mena Quintero [Tue, 27 Nov 2018 18:13:31 +0000 (12:13 -0600)]
(#1471): base64-encode included SVGs to avoid mis-escaped characters

We wrap SVG data from icons within another SVG with extra styling
information.  The wrapped SVG may contain characters that cannot be
part of a data: URL (https://fetch.spec.whatwg.org/#data-urls).

Librsvg 2.45 got more strict in its parsing of data: URLs; whereas
previously it ignored '#' characters in them, now it considers them to
be the start of a fragment identifier, which is not allowed in data:
URLs anyway.

To avoid unallowed characters, we now create a data: URL with a
base-64 encoded SVG.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1471

7 years agoheaderbar: Remove superfluous parentheses
Timm Bäder [Tue, 27 Nov 2018 05:06:28 +0000 (06:06 +0100)]
headerbar: Remove superfluous parentheses

7 years agowidget: Query CSS values later in size_allocate
Timm Bäder [Tue, 27 Nov 2018 05:00:30 +0000 (06:00 +0100)]
widget: Query CSS values later in size_allocate

Move it below the "this widget only changed its position" check.

7 years agowidget: Save baseline without CSS values applied
Timm Bäder [Tue, 27 Nov 2018 04:59:47 +0000 (05:59 +0100)]
widget: Save baseline without CSS values applied

Similar to what we do with width/height.

7 years agoadwaita: icon-shadow -> -gtk-icon-shadow
Timm Bäder [Tue, 27 Nov 2018 04:39:07 +0000 (05:39 +0100)]
adwaita: icon-shadow -> -gtk-icon-shadow

7 years agogl renderer: Use stack to keep track of modelview matrix
Timm Bäder [Mon, 26 Nov 2018 16:52:35 +0000 (17:52 +0100)]
gl renderer: Use stack to keep track of modelview matrix

So we can avoid calculating metadata for matrices all the time.

7 years agocolorplane: Convert crosshair rendering to snapshot
Timm Bäder [Fri, 23 Nov 2018 10:22:51 +0000 (11:22 +0100)]
colorplane: Convert crosshair rendering to snapshot

This is slightly different than the cairo version since the
half-transparent lines now overlap but nobody can see that anyway.

7 years agocolorscale: Cache hue texture
Timm Bäder [Fri, 23 Nov 2018 09:57:50 +0000 (10:57 +0100)]
colorscale: Cache hue texture

Otherwise we regenerate a new one on every snapshot() call.

7 years agogldriver: Don't create surfaces to upload textures
Timm Bäder [Sat, 24 Nov 2018 10:15:29 +0000 (11:15 +0100)]
gldriver: Don't create surfaces to upload textures

7 years agowidget: Parent widgets may also consume motions
Timm Bäder [Wed, 21 Nov 2018 16:51:10 +0000 (17:51 +0100)]
widget: Parent widgets may also consume motions

This is important when the target widget of an event is not the one that
would otherwise receive the gesture. For example, the GtkSwitch
implementation currently attaches a pan gesture to the switch itself,
but the target widget below the pointer might be the switch slider or
label.

See #1465

7 years agoswitch: Shorten size_allocate impl a bit
Timm Bäder [Tue, 20 Nov 2018 17:11:50 +0000 (18:11 +0100)]
switch: Shorten size_allocate impl a bit

7 years agoAdwaita: help fullcolor app icons
Jakub Steiner [Mon, 26 Nov 2018 16:33:28 +0000 (17:33 +0100)]
Adwaita: help fullcolor app icons

- draw a large dropshadow for aboutboxes
- draw an outline for low res

See issues #1434 and #1445.

7 years agoAdwaita: tone down broders, buttons
Jakub Steiner [Fri, 23 Nov 2018 16:32:46 +0000 (17:32 +0100)]
Adwaita: tone down broders, buttons

- very contrasty lines feel dated in today's flat world
- tone down the contrast a little

7 years agoAdwaita: list buttons
Jakub Steiner [Thu, 22 Nov 2018 12:20:10 +0000 (13:20 +0100)]
Adwaita: list buttons

- tone down buttons when inside lists

Fixes issue #1473

7 years agowidget: gdk_display_get_monitor can return NULL
Timm Bäder [Tue, 20 Nov 2018 11:44:23 +0000 (12:44 +0100)]
widget: gdk_display_get_monitor can return NULL

Fixes #1466

7 years agoentry: Shorten finalize implementation
Timm Bäder [Mon, 19 Nov 2018 17:12:27 +0000 (18:12 +0100)]
entry: Shorten finalize implementation

By using g_clear_pointer and g_clear_object where appropriate.

7 years agoMerge branch 'zbrown/emit-transient-for' into 'master'
Timm Bäder [Tue, 20 Nov 2018 11:29:18 +0000 (11:29 +0000)]
Merge branch 'zbrown/emit-transient-for' into 'master'

window: Actually emit notify::transient-for

See merge request GNOME/gtk!424

7 years agowindow: Actually emit notify::transient-for
Zander Brown [Mon, 19 Nov 2018 21:07:17 +0000 (21:07 +0000)]
window: Actually emit notify::transient-for

Because it seems we weren't doing that

7 years agoMerge branch 'benzea/foreach-documentation' into 'master'
Timm Bäder [Mon, 19 Nov 2018 13:38:34 +0000 (13:38 +0000)]
Merge branch 'benzea/foreach-documentation' into 'master'

container: Document that removal from foreach is permissible

Closes #1461

See merge request GNOME/gtk!423

7 years agocontainer: Document that removal from foreach is permissible
Benjamin Berg [Mon, 19 Nov 2018 12:48:36 +0000 (13:48 +0100)]
container: Document that removal from foreach is permissible

It is permissable to remove a widget using gtk_container_remove from the
gtk_container_foreach callback handler. Document this fact to make it
more discoverable.

Fixes #1461

7 years agoMerge branch 'akitouni/gdkvulkan-doc-typo' into 'master'
Timm Bäder [Mon, 19 Nov 2018 07:41:36 +0000 (07:41 +0000)]
Merge branch 'akitouni/gdkvulkan-doc-typo' into 'master'

vulkancontext: fix typos in documentation

See merge request GNOME/gtk!417

7 years agoMerge branch 'more-nullable' into 'master'
Timm Bäder [Mon, 19 Nov 2018 07:40:39 +0000 (07:40 +0000)]
Merge branch 'more-nullable' into 'master'

g-i: Add some nullable annotations

See merge request GNOME/gtk!419

7 years agog-i: Add some nullable annotations
Christoph Reiter [Sun, 18 Nov 2018 12:36:50 +0000 (13:36 +0100)]
g-i: Add some nullable annotations

Based on grepping arg docs for NULL.
See https://gitlab.gnome.org/GNOME/pygobject/issues/261

7 years agovulkancontext: fix typos in documentation
Abderrahim Kitouni [Sat, 17 Nov 2018 18:35:47 +0000 (19:35 +0100)]
vulkancontext: fix typos in documentation

7 years agoMerge branch 'jjardon/no_G_TYPE_INSTANCE_GET_PRIVATE' into 'master'
Timm Bäder [Thu, 15 Nov 2018 09:59:01 +0000 (09:59 +0000)]
Merge branch 'jjardon/no_G_TYPE_INSTANCE_GET_PRIVATE' into 'master'

Stop using G_TYPE_INSTANCE_GET_PRIVATE completely

See merge request GNOME/gtk!402

7 years agoMerge branch 'include-ft2build.h' into 'master'
Timm Bäder [Wed, 14 Nov 2018 13:30:28 +0000 (13:30 +0000)]
Merge branch 'include-ft2build.h' into 'master'

font chooser: Properly include freetype headers

Closes #1432

See merge request GNOME/gtk!413

7 years agowidget: Fix size-allocate signal docs
Timm Bäder [Tue, 13 Nov 2018 19:54:18 +0000 (20:54 +0100)]
widget: Fix size-allocate signal docs

7 years agoUse g_clear_pointer to unparent widgets
Timm Bäder [Tue, 13 Nov 2018 19:53:14 +0000 (20:53 +0100)]
Use g_clear_pointer to unparent widgets

7 years agowidget: Don't pass a position to ->size_allocate
Timm Bäder [Thu, 16 Aug 2018 04:53:03 +0000 (06:53 +0200)]
widget: Don't pass a position to ->size_allocate

The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.

7 years agodocs: Add GtkEventControllerLegacy
Timm Bäder [Tue, 13 Nov 2018 14:33:31 +0000 (15:33 +0100)]
docs: Add GtkEventControllerLegacy

7 years agovulkancontext: Add missing error switch
Timm Bäder [Tue, 13 Nov 2018 14:28:28 +0000 (15:28 +0100)]
vulkancontext: Add missing error switch

7 years agoappchooserbutton: Remove priv pointer
Timm Bäder [Tue, 13 Nov 2018 14:14:10 +0000 (15:14 +0100)]
appchooserbutton: Remove priv pointer

7 years agotestappchooserbutton: Fix for class hierarchy change
Timm Bäder [Tue, 13 Nov 2018 14:13:47 +0000 (15:13 +0100)]
testappchooserbutton: Fix for class hierarchy change

7 years agoappchooserbutton: Inherit from GtkWidget
Timm Bäder [Tue, 13 Nov 2018 14:01:21 +0000 (15:01 +0100)]
appchooserbutton: Inherit from GtkWidget

7 years agorender: Fix a position/size mixup
Timm Bäder [Tue, 13 Nov 2018 13:08:32 +0000 (14:08 +0100)]
render: Fix a position/size mixup

Fixes the foreigndrawing demo.

7 years agotoolbar: Remove dead code
Timm Bäder [Tue, 13 Nov 2018 04:09:35 +0000 (05:09 +0100)]
toolbar: Remove dead code

The size definitely changes, otherwise ->size_allocate does not get
called.

7 years agotoolbar: Remove some unused defines
Timm Bäder [Tue, 13 Nov 2018 04:09:24 +0000 (05:09 +0100)]
toolbar: Remove some unused defines

7 years agowayland: Adapt to settings portal api change
Matthias Clasen [Mon, 12 Nov 2018 18:51:56 +0000 (13:51 -0500)]
wayland: Adapt to settings portal api change

ReadAll now accepts an array of patterns.

7 years agoMerge branch 'scroll-event-propagation' into 'master'
Carlos Garnacho [Mon, 12 Nov 2018 10:05:46 +0000 (10:05 +0000)]
Merge branch 'scroll-event-propagation' into 'master'

eventcontrollerscroll: Conditionally propagate ::scroll

Closes #45

See merge request GNOME/gtk!250

7 years agoeventcontrollerscroll: Conditionally propagate ::scroll
Ernestas Kulik [Wed, 18 Jul 2018 13:34:39 +0000 (16:34 +0300)]
eventcontrollerscroll: Conditionally propagate ::scroll

Currently, gtk_event_controller_scroll_handle_event() always returns
TRUE if it is handled, which stops the propagation of the event. If
there’s a single GtkEventControllerScroll in the widget hierarchy, that
means that no others will run, depending on the propagation phase. In
Nautilus, this can be observed when adding a scroll controller to the
GtkScrolledWindow (ctrl-scrolling controls the zoom level) - either the
scrolling or the zooming breaks.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/45

7 years agofont chooser: Properly include freetype headers
Leonardo Taccari [Fri, 9 Nov 2018 21:13:30 +0000 (22:13 +0100)]
font chooser: Properly include freetype headers

freetype headers should be included via <ft2build.h> and then
indirectly via FT_*_H macros.

Fixes issue #1432.

7 years agocalendar: Remove unused struct member
Timm Bäder [Fri, 9 Nov 2018 19:18:13 +0000 (20:18 +0100)]
calendar: Remove unused struct member

7 years agoscrolledwindow: Remove some useless code
Timm Bäder [Fri, 9 Nov 2018 18:37:55 +0000 (19:37 +0100)]
scrolledwindow: Remove some useless code

This is all being done already be the add_class/remove_class calls
before.

7 years agoscale: Don't set label css name to "label"
Timm Bäder [Fri, 9 Nov 2018 17:59:30 +0000 (18:59 +0100)]
scale: Don't set label css name to "label"

That's already the css name of all labels.

7 years agocolorscale: Remove x/y arguments from snapshot_scale
Timm Bäder [Fri, 9 Nov 2018 17:01:26 +0000 (18:01 +0100)]
colorscale: Remove x/y arguments from snapshot_scale

We only pass 0 anyway.

7 years agoAdwaita: use HIG grey for bg_color
Jakub Steiner [Fri, 9 Nov 2018 14:37:08 +0000 (15:37 +0100)]
Adwaita: use HIG grey for bg_color

- refresh with a light bg color, use the new color palette

7 years agoAdwaita: fix osd bg color
Jakub Steiner [Fri, 9 Nov 2018 10:19:41 +0000 (11:19 +0100)]
Adwaita: fix osd bg color

- don't try deriving from bg_color, osd should be consistent
  for light & dark.

FIxes issue #1449

7 years agoAdwaita: Propagate bg color to titlebar separator descendants
Adrien Plazas [Tue, 24 Jul 2018 12:37:57 +0000 (14:37 +0200)]
Adwaita: Propagate bg color to titlebar separator descendants

Gives the same background color to all separators descending from a
title bar than to its direct childrens.

This prevents separators which are in a titlebar but not direct children
from the widget with the titlebar style class from being almost
transparent and hence it prevent them from revealing the clear color of
the window's titlebar (black).

https://gitlab.gnome.org/GNOME/gtk/issues/1231

7 years agoMerge branch 'wip/jimmac/insensitive-progress' into 'master'
Jakub Steiner [Fri, 9 Nov 2018 07:27:49 +0000 (07:27 +0000)]
Merge branch 'wip/jimmac/insensitive-progress' into 'master'

Adwaita: draw insensitive progressbars

See merge request GNOME/gtk!360

7 years agoMerge branch 'wip/jimmac/hig-colors-gtk4' into 'master'
Jakub Steiner [Fri, 9 Nov 2018 07:25:05 +0000 (07:25 +0000)]
Merge branch 'wip/jimmac/hig-colors-gtk4' into 'master'

Adwaita: use new HIG colors

See merge request GNOME/gtk!407

7 years agoAdwaita: use new HIG colors
Jakub Steiner [Mon, 5 Nov 2018 15:10:50 +0000 (16:10 +0100)]
Adwaita: use new HIG colors

- blue selection color, success & destructive colors updates
- blueish tint for dark

Addresses issue #1443

7 years agotestpopup: Fix GtkEventControllerMotion::motion callback signature
Timm Bäder [Thu, 8 Nov 2018 04:19:48 +0000 (05:19 +0100)]
testpopup: Fix GtkEventControllerMotion::motion callback signature

7 years agoeventcontrollerlegact: Fix ::event docs
Timm Bäder [Thu, 8 Nov 2018 04:19:30 +0000 (05:19 +0100)]
eventcontrollerlegact: Fix ::event docs

As discussed in !388.

7 years agoicontheme: Stop exporting gtk_icon_info_new_for_file
Timm Bäder [Tue, 30 Oct 2018 15:31:09 +0000 (16:31 +0100)]
icontheme: Stop exporting gtk_icon_info_new_for_file

7 years agoicontheme: Stop exporting gtk_icon_theme_color_symbolic_pixbuf
Timm Bäder [Tue, 30 Oct 2018 15:23:08 +0000 (16:23 +0100)]
icontheme: Stop exporting gtk_icon_theme_color_symbolic_pixbuf

7 years agoicontheme: Drop remaining emblem code
Timm Bäder [Tue, 30 Oct 2018 15:18:23 +0000 (16:18 +0100)]
icontheme: Drop remaining emblem code

7 years agoicontheme: Don't reference nonexistent parameter in docs
Timm Bäder [Mon, 29 Oct 2018 10:27:04 +0000 (11:27 +0100)]
icontheme: Don't reference nonexistent parameter in docs

7 years agoicontheme: Use a bit field in AsyncSymbolicData
Timm Bäder [Mon, 29 Oct 2018 10:26:05 +0000 (11:26 +0100)]
icontheme: Use a bit field in AsyncSymbolicData

176 -> 144 bytes

7 years agoicontheme: Stop strdup'ing css colors when loading
Timm Bäder [Mon, 29 Oct 2018 10:10:42 +0000 (11:10 +0100)]
icontheme: Stop strdup'ing css colors when loading

... symbolic icons.

7 years agogl renderer: Properly retrieve matrix scale
Timm Bäder [Sun, 12 Aug 2018 15:42:58 +0000 (17:42 +0200)]
gl renderer: Properly retrieve matrix scale

So rotating offscreen nodes works.

7 years agowidget: Avoid some more ->priv accesses
Timm Bäder [Thu, 18 Oct 2018 10:00:47 +0000 (12:00 +0200)]
widget: Avoid some more ->priv accesses

7 years agorange: Remove multipress_gesture member
Timm Bäder [Thu, 18 Oct 2018 08:53:32 +0000 (10:53 +0200)]
range: Remove multipress_gesture member

We don't need it in the instance struct since we only set it up and then
access it in its signal callbacks.

7 years agowidget: Some whitespace fixes
Timm Bäder [Wed, 17 Oct 2018 18:15:34 +0000 (20:15 +0200)]
widget: Some whitespace fixes

7 years agoPopover: Minimally document the ::closed signal
Daniel Boles [Mon, 5 Nov 2018 23:36:54 +0000 (23:36 +0000)]
Popover: Minimally document the ::closed signal

This is better than nothing at all. The wording is taken from Carlos's
commit message when he added this shortly before 3.12 (but skip Since).
Skip the bit from his commit message explaining what this replaced; we
don't need to say all the less good things our convenience API replaces.

7 years agotesttreelistmodel: Don't use non-standard function
Daniel Boles [Wed, 24 Oct 2018 18:48:45 +0000 (19:48 +0100)]
testtreelistmodel: Don't use non-standard function

as per efd3758f6a779041ff552cb4c5163446fd951368 strcasecmp() is not a C
standard thing (not that we bothered including any header for it anyway)
and so this test failed to build on Windows with Microsoft Visual C.

7 years agoTreeMenu: Don't manually reinvent g_list_index()
Daniel Boles [Sat, 20 Oct 2018 14:19:11 +0000 (15:19 +0100)]
TreeMenu: Don't manually reinvent g_list_index()

g_list_index() "Gets the position of the element containing the given
data (starting from 0)." That is exactly what we were manually doing.

7 years agogtk/gtktoolbutton.c: Document why we need to still use G_TYPE_INSTANCE_GET_PRIVATE
Javier Jardón [Wed, 7 Nov 2018 17:27:00 +0000 (17:27 +0000)]
gtk/gtktoolbutton.c: Document why we need to still use G_TYPE_INSTANCE_GET_PRIVATE

This is the excellent explanation from Emmanuele at
https://gitlab.gnome.org/GNOME/gtk/merge_requests/402#note_361210:
"
Every time you instantiate a type, the instance_init() function is called for each
parent type T_p of your type T; to preserve invariants, the class pointer inside
the instance data is set to the parent type before each invocation, until you hit
your type T. This means that calling GET_CLASS() inside an instance_init() function
will give you a pointer to the class vtable for the parent type T_p while you're
iterating over parent types. What if you want to access the actual class vtable of
the type T, though? Well, you can because the actual signature of instance_init() is:

  void (* GInstanceInitFunc) (GTypeInstance *instance, gpointer g_class);

i.e. all instance_init() functions get passed the instance they are initialising
and the class vtable of the real type you're instantiating.

This is how GtkToolButton works: it "peeks ahead" at instance initialisation time,
to use the button_type class field of the actual type you're instantiating,
and calls g_object_new() with it to store the resulting object in its own private
data structure.

This whole contrived mechanism is needed to allow out-of-tree tool buttons to just
set the button type on their class init, and have their parent class create the
button they want, instead of asking all tool buttons to do this themselves and have
a virtual function called get_button() for GtkToolButton to call whenever it needs
to operate on the button instance.

Now we're coming to a close: we cannot use the G_DEFINE_TYPE macro because the
instance_init() function it creates internally will not pass the class pointer
to your custom instance_init(). Since we cannot use G_DEFINE_TYPE, we also cannot use
G_ADD_PRIVATE either.

This is the reason why, when I ported GTK 3 to the new private instance data structure
macros, I left GtkToolButton alone. I should have left a comment there, because @matthiasc
tried doing that as well, and then had to revert it in commit 1c4a7bd5. So: my bad,
sorry about that.

If we want to drop the G_TYPE_INSTANCE_GET_PRIVATE and the g_type_class_add_private() calls,
we cannot use G_DEFINE_TYPE, but what we can do is unrolling what the macros do themselves:

- add a global GtkToolButton_private_offset variable
- add a static inline gtk_tool_button_get_instance_private() that does return
(G_STRUCT_MEMBER_P (self, GtkToolButton_private_offset));
- call g_type_add_instance_private (g_define_type_id, sizeof (GtkToolButtonPrivate)) inside
gtk_tool_button_get_type() and store the result in GtkToolButton_private_offset
- replace g_type_class_add_private() inside gtk_tool_button_class_init() with
g_type_class_adjust_private_offset (klass, &GtkToolButton_private_offset)
"

7 years agogtk/gtktextview.c: Remove unused GTK_TEXT_VIEW_GET_PRIVATE() macro
Javier Jardón [Tue, 6 Nov 2018 13:45:58 +0000 (13:45 +0000)]
gtk/gtktextview.c: Remove unused GTK_TEXT_VIEW_GET_PRIVATE() macro

7 years agoMerge branch 'wip/3v1n0/recent-info-cleanup' into 'master'
Timm Bäder [Tue, 6 Nov 2018 09:52:11 +0000 (09:52 +0000)]
Merge branch 'wip/3v1n0/recent-info-cleanup' into 'master'

gtk-autocleanups: add cleanup function for GtkRecentInfo

See merge request GNOME/gtk!409

7 years agowayland: Fix a thinko in settings portal support
Matthias Clasen [Mon, 5 Nov 2018 23:12:40 +0000 (18:12 -0500)]
wayland: Fix a thinko in settings portal support

When we decide to fall back because the settings portal
is not present, adhere to that decision elsewhere. And
treat the fontconfig-timestamp like the other special-cased
settings, with G_TYPE_NONE.

7 years agogtk-autocleanups: add cleanup function for GtkRecentInfo
Marco Trevisan [Mon, 5 Nov 2018 21:37:42 +0000 (21:37 +0000)]
gtk-autocleanups: add cleanup function for GtkRecentInfo

7 years agoMerge branch 'wip/settings-portal' into 'master'
Matthias Clasen [Sun, 4 Nov 2018 20:57:26 +0000 (20:57 +0000)]
Merge branch 'wip/settings-portal' into 'master'

settings portal

See merge request GNOME/gtk!403

7 years agowayland: Support the settings portal
Matthias Clasen [Thu, 1 Nov 2018 23:47:46 +0000 (19:47 -0400)]
wayland: Support the settings portal

Under Wayland, we are currently directly using GSettings
for desktop settings. But in a sandbox, we may not have
access to dconf, so this may fail. Use the new settings
portal instead.

7 years agoMove the should_use_portal helper to gdk
Matthias Clasen [Thu, 1 Nov 2018 17:46:04 +0000 (13:46 -0400)]
Move the should_use_portal helper to gdk

We want to use it there too, in the future.
Update all callers.

7 years agoUse a simpler sandbox check
Matthias Clasen [Thu, 1 Nov 2018 17:31:10 +0000 (13:31 -0400)]
Use a simpler sandbox check

No need to use the runtime dir and allocate a string.
We can just check in /.

7 years agoMerge branch 'wip/fmuellner/deco-setting' into 'master'
Matthias Clasen [Fri, 2 Nov 2018 16:18:25 +0000 (16:18 +0000)]
Merge branch 'wip/fmuellner/deco-setting' into 'master'

wayland: Remove GNOME Classic-specific workaround

See merge request GNOME/gtk!400

7 years agowayland: Remove GNOME Classic-specific workaround
Florian Müllner [Fri, 2 Nov 2018 15:04:56 +0000 (16:04 +0100)]
wayland: Remove GNOME Classic-specific workaround

As GSettings now supports session-specific defaults, GNOME Classic
no longer uses a separate schema and the decoration layout is always
determined by the regular schema.

This essentially reverts commit add67b516cb6 (although the code was
moved since then).

https://gitlab.gnome.org/GNOME/gtk/merge_requests/400

7 years agoGdkQuartz: Handle NULL from [NSGraphicsContext currentContext].
John Ralls [Sat, 20 Oct 2018 19:27:46 +0000 (12:27 -0700)]
GdkQuartz: Handle NULL from [NSGraphicsContext currentContext].

By returning a default surface. The situation where there's no
currentContext arises when GtkCSS is trying to determine the
layout sizes so no actual display is necessary.

Closes: #1411